package com.xidian.zhiancloud.controller.luling.RiskIdentificationPart;
import com.xidian.zhiancloud.dto.ResultDTO;
import com.xidian.zhiancloud.enums.GeneralResponseEnums;
import com.xidian.zhiancloud.model.RiskIdentEvalStatus;
import com.xidian.zhiancloud.service.luling.RiskIdentificationPart.RiskIdentEvalStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.sql.Date;
/**
 ** 风险辨识评价计划接口
 * @Author:luling
 * @Date:2021/1/7   15:24
 */
@RestController
@RequestMapping("/RiskIdentEvalStatus")
public class RiskIdentEvalStatusController {
    @Autowired
    private RiskIdentEvalStatusService  riskIdentEvalStatusService;
    /**
     *添加风险辨识评价信息
     *@param   riskIdentEvalStatus 风险辨识评价对象
     *@return ResultDTO 对象
     */
    @PostMapping("/insert")
    public ResultDTO<Boolean> add(@RequestBody RiskIdentEvalStatus riskIdentEvalStatus) {
        riskIdentEvalStatusService.add(riskIdentEvalStatus);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据id删除风险辨识评价信息
     * @param  id    公司id
     * @return ResultDTO对象
     */
    @DeleteMapping("/delete/{id}")
    public ResultDTO<Boolean> deleteById(@PathVariable Long id) {
        riskIdentEvalStatusService.deletebyid(id);
        return ResultDTO.successOf(GeneralResponseEnums.SUCCESS);
    }
    /**
     * 根据state获取风险辨识评价信息
     *
     * @param state 风险辨识评价对象的state
     * @return  返回风险辨识评价对象
     */
    @GetMapping("/getById/{state}")
    public ResultDTO<Object> getById(
            @PathVariable String state) {
        return ResultDTO.successOf(riskIdentEvalStatusService.getById(state), GeneralResponseEnums.SUCCESS);
    }
    /**
     * 列表查询
     *
     * @param  riskName   辨识评价计划名称
     * @param startTime  辨识评价开始时间
     * @param  deadlineIden  辨识截止时间
     * @param  deadlineEval  评价截止时间
     * @param  type  辨识评价类型
     * @param   key    关键字
     * @param current   分页偏移量
     * @param size    每一页的数量
     * @return 返回风险辨识评价列表
     **/
    @GetMapping("/getList")
    public ResultDTO<Object> getList(@RequestParam(value = "riskName", required = false) String riskName,
                             @RequestParam(value = "startTime", required = false) Date startTime,
                             @RequestParam(value = "deadlineIden", required = false) Date deadlineIden,
                             @RequestParam(value = "deadlineEval", required = false) Date deadlineEval,
                             @RequestParam(value = "type", required = false) String type,
                             @RequestParam(value = "key", required = false) String key,
                             @RequestParam(value = "current", required = true) int current,
                             @RequestParam(value = "size", required = true) int size) {
        return ResultDTO.successOf(riskIdentEvalStatusService.getList(riskName, startTime, deadlineIden,deadlineEval,type,key,current, size), GeneralResponseEnums.SUCCESS);
    }
    //导出
    //分解
    //派发
}
